﻿///////////////////////////////////////////////////////////////////////////////
//
// This file is part of the BassDrop project
//   https://code.google.com/p/bass-drop/
//
//
// Creator:	Gergely Krajcsovszki (krajcsovszkig@hotmail.com)
// Date:	2013-08-22 13:10
//
//
// Copyright © 2013-2014. Gergely Krajcsovszki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BassDrop.Core.Common.Data.IO.Portable
{
	/// <summary>
	/// Specifies how the operating system should open a file.
	/// Same as System.IO.FileMode, which is unavailable in portable libraries.
	/// </summary>
	public enum PortableFileMode
	{
		/// <summary>
		/// Opens the file if it exists and seeks to the end of the file, or creates a new file.
		/// This requires FileIOPermissionAccess.Append permission. FileMode.Append can be used only
		/// in conjunction with FileAccess.Write. Trying to seek to a position before the end of the
		/// file throws an IOException exception, and any attempt to read fails and throws a NotSupportedException exception.
		/// </summary>
		Append,
		/// <summary>
		/// Specifies that the operating system should create a new file. If the file already exists, it will be overwritten.
		/// This requires FileIOPermissionAccess.Write permission. FileMode.Create is equivalent to requesting that if the file
		/// does not exist, use CreateNew; otherwise, use Truncate. If the file already exists but is a hidden file,
		/// an UnauthorizedAccessException exception is thrown.
		/// </summary>
		Create,
		/// <summary>
		/// Specifies that the operating system should create a new file. This requires FileIOPermissionAccess.Write permission.
		/// If the file already exists, an IOException exception is thrown.
		/// </summary>
		CreateNew,
		/// <summary>
		/// Specifies that the operating system should open an existing file. The ability to open the file is dependent on the
		/// value specified by the FileAccess enumeration. A System.IO.FileNotFoundException exception is thrown if the file does not exist.
		/// </summary>
		Open,
		/// <summary>
		/// Specifies that the operating system should open a file if it exists; otherwise, a new file should be created. If the file is opened
		/// with FileAccess.Read, FileIOPermissionAccess.Read permission is required. If the file access is FileAccess.Write,
		/// FileIOPermissionAccess.Write permission is required. If the file is opened with FileAccess.ReadWrite, both
		/// FileIOPermissionAccess.Read and FileIOPermissionAccess.Write permissions are required.
		/// </summary>
		OpenOrCreate,
		/// <summary>
		/// Specifies that the operating system should open an existing file. When the file is opened, it should be truncated so that its size is
		/// zero bytes. This requires FileIOPermissionAccess.Write permission. Attempts to read from a file opened with FileMode.Truncate cause an
		/// ArgumentException exception.
		/// </summary>
		Truncate
	}
}
